{include file="/shopro/common/script" /}

<style>
    .withdraw-index .pay {
        width: 24px;
        height: 24px;
        margin-right: 8px;
    }

    .handle-popover .tip {
        margin-bottom: 16px;
    }

    .question-filled {
        color: var(--el-color-warning);
        margin-right: 4px;
    }
</style>

<div id="index" class="withdraw-index panel panel-default panel-intro" v-cloak>
    <el-container class="panel-block">
        <el-header class="sa-header">
            <div class="sa-title sa-flex sa-row-between">
                <div class="sa-title-left">
                    <div class="left-name">奖金池管理</div>
                    <div style="padding-left: 20px;color: red">当前奖金池金额：￥<span class="money">{{state.money}}</span></div>
                    <sa-filter-condition v-model="state.filter" @filter-delete="onChangeFilter">
                    </sa-filter-condition>
                </div>
                <div class="sa-title-right">
                    <el-button class="sa-button-refresh" icon="RefreshRight" @click="getData"></el-button>
                    <el-button class="sa-button-refresh" icon="Search" @click="onOpenFilter"></el-button>
                    {if $auth->check('shopro/bonus_log/export')}
                    <el-button :loading="exportLoading" :disabled="exportLoading" @click="onExport('export')">导出
                    </el-button>
                    {/if}
                </div>
            </div>
        </el-header>
        <el-main class="sa-main">
            <el-table height="100%" class="sa-table" :data="state.data" stripe @sort-change="onChangeSort">
                <el-table-column prop="id" label="ID" min-width="90" sortable="custom">
                </el-table-column>
                <el-table-column label="用户" min-width="158">
                    <template #default="scope">
                        <sa-user-profile :user="scope.row.user" :id="scope.row.user_id"></sa-user-profile>
                    </template>
                </el-table-column>
                <el-table-column label="金额" min-width="166">
                    <template #default="scope">
                        <div class="sa-table-line-1">
                            {{ scope.row.money }}元
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="订单pv值" min-width="166">
                    <template #default="scope">
                        <div class="sa-table-line-1"  v-if="scope.row.money>=0">
                            {{ scope.row.order_pv }}元
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="分红池金额" min-width="166">
                    <template #default="scope">
                        <div class="sa-table-line-1"  v-if="scope.row.money<0">
                            {{ scope.row.order_pv}}元
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="备注" min-width="166">
                    <template #default="scope">
                        <div class="sa-table-line-1">
                            {{ scope.row.momo }}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="比例" min-width="132">
                    <template #default="scope">
                        <div class="sa-table-line-1">
                            {{ scope.row.ratio }}%
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="时间" width="172">
                    <template #default="scope">
                        {{ formatTime(scope.row.createtime) }}
                    </template>
                </el-table-column>
                <el-table-column label="操作" min-width="160" fixed="right">
                    <template #default="scope">
                        <div class="sa-flex">
                            {if $auth->check('shopro/bonus_log/detail')}
                            <el-button type="primary" link @click="onDetail(scope.row.id)">查看</el-button>
                            {/if}
                        </div>
                    </template>
                </el-table-column>
                <!--<el-table-column sortable="custom" prop="createtime_text" label="入池时间" min-width="172"></el-table-column>-->
            </el-table>
        </el-main>
        <el-footer class="sa-footer sa-flex sa-row-right">
            <sa-pagination v-model="pagination" @pagination-change="getData"></sa-pagination>
        </el-footer>
    </el-container>
    <sa-filter v-model="state.filter" @filter-change="onChangeFilter"></sa-filter>
</div>